package gameObject;

import javax.microedition.lcdui.game.LayerManager;
import javax.microedition.lcdui.game.Sprite;

import base.AlignMapObject;
import base.SpriteContainer;

import main.Res;

public class Fence implements SpriteContainer,AlignMapObject{
	protected Sprite sprite;
	
	public Fence() {
		sprite = Res.createFenceSprite();
	}
	public Sprite getSprite()
	{
		return sprite;
	}
	public void addTo(LayerManager layer)
	{
		//layer.append(sprite);
		layer.insert(sprite, layer.getSize()-1);
	}
	public void removeFrom(LayerManager layer)
	{
		layer.remove(sprite);
	}
	public void setMapIndex(int i, int j) {
		sprite.setPosition(i*30, j*30);
	}
	public int getRowIndex() {
		return sprite.getY()/30;
		
	}
	public int getColIndex() {
		return sprite.getX()/30;
	}
}
